# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-topn
pkgver=2.7.0
pkgrel=0
pkgdesc="PostgreSQL extension that returns the top values in database according to some criteria"
url="https://github.com/citusdata/postgresql-topn"
arch="all"
license="AGPL-3.0-only"
makedepends="postgresql-dev"
subpackages="$pkgname-bitcode"
source="https://github.com/citusdata/postgresql-topn/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
options="!check"  # tests require running PostgreSQL

build() {
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

bitcode() {
	pkgdesc="$pkgdesc (bitcode for JIT)"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="postgresql$(pg_config --major-version)-jit $pkgname=$pkgver-r$pkgrel"

	amove usr/lib/postgresql*/bitcode
}

sha512sums="
7bcb73d9891cd217cf4d60c090c6fd048890198f25ab1ee11d12d4d645264b0c396fe0ce5a7debcc181ab006f1d1511f576598261d3ea2893c7d42188ac5c58d  postgresql-topn-2.7.0.tar.gz
"
